package cn.edu.nju.software.gui;

import java.awt.GridLayout;
import javax.swing.*;

import cn.edu.nju.software.net.Connection;
import cn.edu.nju.software.net.StudentBean;

public class PersonalInfo extends JPanel{
	
	Connection connection; 
	StudentsOperation so;
	StudentBean sb;
	
	public PersonalInfo(StudentsOperation soIn){
		super();
		so = soIn;
		connection = Connection.getInstance();
		
		sb = connection.handlePersonalInformation(so.getUsername());//ͨ��so�õ���ǰ���û���
		
		
		GridLayout gridLayout = new GridLayout(3,4);
		setLayout(gridLayout);
		JLabel userNameLabel = new JLabel("userName");
		userNameLabel.setHorizontalAlignment(SwingConstants.RIGHT);
		JLabel userNameValue = new JLabel(sb.getUserName());//���е���Ϣֵ�����滻��һ����������ݿ���������
		JLabel nameLabel = new JLabel("name");
		nameLabel.setHorizontalAlignment(SwingConstants.RIGHT);
		JLabel  nameValue= new JLabel(sb.getName());
		JLabel IDLabel = new JLabel("ID");
		IDLabel.setHorizontalAlignment(SwingConstants.RIGHT);
		JLabel  IDValue= new JLabel(sb.getId());
		JLabel instituteLabel = new JLabel("institute");
		instituteLabel.setHorizontalAlignment(SwingConstants.RIGHT);
		JLabel  instituteValue= new JLabel(sb.getInstitute());
		JLabel genderLabel = new JLabel("gender");
		genderLabel.setHorizontalAlignment(SwingConstants.RIGHT);
		JLabel  genderValue= new JLabel(sb.getGender());
		
		
		add(userNameLabel);
		add(userNameValue);
		add(nameLabel);
		add(nameValue);
		add(IDLabel);
		add(IDValue);
		add(instituteLabel);
		add(instituteValue);
		add(genderLabel);
		add(genderValue);
		
		
		}

}
